// pages/address/jd-address/jd-address.js
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  
  /**
   * 页面的初始数据
   */
  data: {
    isShowArea: false
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  // 得到地址
  getAddress(){
    var addressType = 1
    var addressDTO = {
      showArea: true,
      addressType: addressType,
      provinceDTO: {},
      cityDTO: {},
      countyDTO: {},
    }
    this.setData({
      isShowArea: true,
      defaultAddressDTO: addressDTO, //默认项值
    })
  },

  getProvinceAddress(){
    var addressType = 2
    var addressDTO = {
      showArea: true,
      addressType: addressType,
      provinceDTO: {},
      cityDTO: {},
      countyDTO: {},
    }
    this.setData({
      isShowArea: true,
      defaultAddressDTO: addressDTO, //默认项值
    })
  },

  getCityAddress(){
    var addressType = 3
    var addressDTO = {
      showArea: true,
      addressType: addressType,
      provinceDTO: {},
      cityDTO: {},
      countyDTO: {},
    }
    this.setData({
      isShowArea: true,
      defaultAddressDTO: addressDTO, //默认项值
    })
  },

  // 下拉框返回值 
  suerPicker(e) {
    var addressType = e.detail.addressType

    if (addressType == 1){
      this.setData({
        addressDesc: e.detail.provinceDTO.name+e.detail.cityDTO.name+e.detail.countyDTO.name
      })
    } else if (addressType == 2) {
      this.setData({
        addressProvinceDesc: e.detail.provinceDTO.name+e.detail.cityDTO.name+e.detail.countyDTO.name
      })
    } else if (addressType == 3) {
      this.setData({
        addressCityDesc: e.detail.provinceDTO.name+e.detail.cityDTO.name+e.detail.countyDTO.name
      })
    }
    
    
  }
})